package com.example.questionsystem.modules.qu.common;

import java.util.LinkedHashMap;
import java.util.Map;

public class TableDefinitions {
    // 表名 -> 建表SQL
    public static final Map<String, String> TABLES = new LinkedHashMap<>();

    static {
        // 项目表
        TABLES.put(
            "projects",
            "CREATE TABLE IF NOT EXISTS projects (\n" +
                    " project_id TEXT  NOT NULL,\n" +
                    " project_name TEXT NOT NULL,\n" +
                    " subject_count INTEGER NOT NULL,\n" +
                    " created_at TEXT NOT NULL DEFAULT (datetime('now')),\n" +
                    " updated_at TEXT NOT NULL\n" +
                    "\n" +
                    "    );"
        );

        // 科目场次表
        TABLES.put(
            "subject_sessions",
            "CREATE TABLE IF NOT EXISTS subject_sessions (\n" +
                    " subject_id TEXT  NOT NULL,\n" +
                    " project_id TEXT NOT NULL,\n" +
                    " subject_name TEXT NOT NULL,\n" +
                    " kmxh TEXT NOT NULL,\n" +
                    " start_time TEXT NOT NULL ,\n" +
                    " end_time TEXT NOT NULL,\n" +
                    " session_name TEXT NOT NULL\n" +
                    "\n" +
                    ");"
        );

        // 题目表
        TABLES.put(
                "question_banks",
                "CREATE TABLE IF NOT EXISTS question_banks (\n" +
                        "  project_id TEXT NOT NULL,\n" +
                        "  question_id TEXT NOT NULL,\n" +
                        "  subject_id TEXT NOT NULL,\n" +
                        "  parent_id TEXT,\n" +
                        "  question_text TEXT NOT NULL,\n" +
                        "  question_type TEXT NOT NULL,\n" +
                        "  options TEXT,\n" +
                        "  answer TEXT,\n" +
                        "  score TEXT,\n" +
                        "  created_at TEXT DEFAULT (datetime('now')),\n" +
                        "  question_html TEXT ,\n" +
                        "  options_html TEXT ,\n" +
                        "  child_count TEXT,\n" +
                        "  knowledge TEXT,\n" +
                        "  usage_count TEXT\n" +
                        "\n" +
                        ");"
        );
    }
}